package com.eqdd.yiqidian.ui.mine.pizhun;

import android.databinding.DataBindingUtil;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;

import com.eqdd.yiqidian.MyRenwuActivityCustom;
import com.eqdd.yiqidian.R;
import com.eqdd.yiqidian.adapter.slimadapter.SlimAdapterEx;
import com.eqdd.yiqidian.adapter.slimadapter.SlimInjector;
import com.eqdd.yiqidian.adapter.slimadapter.viewinjector.IViewInjector;
import com.eqdd.yiqidian.base.BaseActivity;
import com.eqdd.yiqidian.bean.ThirdBean;

import java.util.ArrayList;

public class MyPizhunOldActivity extends BaseActivity {
    private MyRenwuActivityCustom dataBinding;
    private ArrayList<ThirdBean> thirdBeen;

    @Override
    public void initBinding() {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_my_renwu);
        initTopTitleBar(View.VISIBLE, "我的批准");
//        initTopRightText("发布任务", v -> {
//
//        });
    }

    @Override
    public void initData() {
        thirdBeen = new ArrayList<>();
        thirdBeen.add(new ThirdBean("出差", "张晓娜", "6.15～6.18"));
        thirdBeen.add(new ThirdBean("请假", "王军", "6.22～6.23"));
        thirdBeen.add(new ThirdBean("请假", "李海", "6.22～6.23"));
        thirdBeen.add(new ThirdBean("加班", "赵德信", "6.22～6.23"));
        thirdBeen.add(new ThirdBean("出差", "蔡星", "6.22～6.28"));
    }

    @Override
    public void setView() {
        dataBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));

        SlimAdapterEx slimAdapterEx = SlimAdapterEx.create().register(R.layout.list_item_13, new SlimInjector<ThirdBean>() {
            @Override
            public void onInject(ThirdBean data, IViewInjector injector) {

                injector.text(R.id.tv_left_center_content,data.getFirst())
                        .text(R.id.tv_upper_right_content,data.getSecond())
                        .text(R.id.tv_down_right_content,data.getThird());
            }
        }).attachTo(dataBinding.recyclerView);
        slimAdapterEx.updateData(thirdBeen);
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {

        }
    }
}
